package com.deuwise.system.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import java.util.Date;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.deuwise.common.annotation.DateTime;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;

/**
 * 
 *@author deuwise
 *@date 2018-11-06 14:15:04
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName("sys_user")
public class SysUser extends Model<SysUser>  implements Serializable{
    /**主键*/
    @ApiModelProperty("主键")
    @TableField("id")
    @TableId
    private String id;

    /**用户名称*/
    @ApiModelProperty("用户名")
    @TableField("user_name")
    @NotBlank(message="用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Length(max =80,message ="用户名长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String username;

    /**密码*/
    @ApiModelProperty("密码")
    @TableField("password")
    @NotBlank(message="密码不能为空", groups = AddGroup.class)
    @Length(max =100,message ="密码长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String password;

    /**名称*/
    @ApiModelProperty("名称")
    @TableField("name")
    @Length(max =80,message ="名称长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String name;

    /**部门Id*/
    @ApiModelProperty("部门Id")
    @TableField("dept_id")
    private String deptId;

    @ApiModelProperty("部门命称")
    @TableField(exist = false)
    private String deptName;

    /**邮箱*/
    @ApiModelProperty("邮箱")
    @TableField("email")
    @NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
    @Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    @Length(max =60,message ="邮箱长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String email;

    /**mobile*/
    @ApiModelProperty("mobile")
    @TableField("mobile")
    @Length(max =60,message ="手机长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String mobile;

    /**状态 0:禁用，1:正常*/
    @ApiModelProperty("状态 0:禁用，1:正常")
    @TableField("status")
    private Integer status;

    /**性别*/
    @ApiModelProperty("性别")
    @TableField("sex")
    private Integer sex;

    /**birth*/
    @ApiModelProperty("birth")
    @TableField("birth")
    private Date birth;

    /**删除标识*/
    @ApiModelProperty("删除标识")
    @TableField("deleted")
    private Integer deleted;

    @TableField(exist = false)
    private  List<String> roleIdList;

   @Override
    protected Serializable pkVal() {
        return id;
    }

}